Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Network type to support private tangles #360

Merged
merged 32 commits into from
Aug 24, 2021

Conversation

PhilippGackstatter
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter commented Aug 18, 2021

Description of change

Currently, the Network enum consists only of two types: test and main. To support private tangle networks, another variant was added, called Other, which contains the name of the network.

An unfortunate side-effect of this change is that the Network type can no longer be Copy, which introduces a bunch of .clone() invocations in various places.

One thing I'd like to discuss is the change in Network::from_name. We said we wanted to prevent empty strings from being valid network names. That changes the signature of that method to be a Result, which obviously means callers need to handle that every single time they create a network. I'm no longer sure that tiny check justifies this downside in usability, and I would actually like to remove it again. If we actually wanted to introduce more "safety" for network names, we would also need to check for all kinds of unicode white space in the name, and disallow that, too. That's not a very cheap check and not sure if it's worth it overall.

Another change that results from the added Other variant, is that there are no longer an obvious default_node_url or explorer_url, which means those methods also return Results.

Links to any relevant issues

fixes #355

Type of change

Add an x to the boxes that are relevant to your changes.

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • Signatures of public methods changed, in particular of Network methods.
  • Documentation Fix

How the change has been tested

I ran a one-click-tangle and then ran the new examples for Rust and JS. These then produce a document with a DID such as:

did:iota:private-tangle:4NcFXKH6B3PvDyZrFQz2Fowpxmw7QN8e2Ky14Kk7Qwan

I don't think there's an easy way to add an automated test for these changes.

Change checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@PhilippGackstatter PhilippGackstatter marked this pull request as ready for review August 19, 2021 08:05
Copy link
Contributor

@cycraig cycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the overall approach is fine.

The alternative would be to make the Network a proper struct so developers can set the default_node_url and explorer_url manually, but that requires a larger refactor to avoid cloning the strings around every time Network is used somewhere. It would also overlap a bit too much with the Config and might be confusing to new users where one should set the node_url for example.

The private_tangle examples not being testable is not ideal. Either we can spin up a private Tangle in GitHub Actions (not impossible) or we throw a predefined error message when publish_document fails and catch it, to ensure there are no e.g. syntax errors. I do think the new examples should be added to the tests either way.

I believe the custom network names need to be validated according to the IOTA DID Spec as they form part of generated DID strings (when not published to "main", which is the default and excluded). E.g. "did:iota:Private-tangle:H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" is not valid. Unless I'm mistaken this is the main thing that needs to change, the rest is debatable.

identity-iota/src/tangle/network.rs Outdated Show resolved Hide resolved
identity-iota/src/tangle/network.rs Outdated Show resolved Hide resolved
identity-iota/src/did/url/iota_did.rs Outdated Show resolved Hide resolved
bindings/wasm/examples/browser/main.js Show resolved Hide resolved
bindings/wasm/examples/browser/private_tangle.js Outdated Show resolved Hide resolved
Copy link
Contributor

@cycraig cycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I prefer returning errors with ? in examples over unwrap(). It avoids the comments too.

examples/account/private_tangle.rs Outdated Show resolved Hide resolved
examples/account/private_tangle.rs Show resolved Hide resolved
examples/low-level-api/private_tangle.rs Outdated Show resolved Hide resolved
@PhilippGackstatter
Copy link
Contributor Author

Since the last review, these were the significant changes:

  • Added the examples to the jest and cypress tests
  • Since it's possible to have private explorers, I've added the ability to set the explorer url. When retrieving the url, I've made it an error if no explorer url was set prior to that call. Most of the times we'll be working with the mainnet and testnet, where explorer urls are always available. Thus making network.explorer_url() return an Option would be cumbersome to work with, when most of the time it'd be a Some anyway.

Other than that I've incorporated the requested changes. Please take another look @cycraig, thanks!

Copy link
Contributor

@cycraig cycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Minor comments.

Overall I think this is a compromise between keeping a lightweight enum as the Network was previously and a full struct, the latter of which might need a builder pattern etc. The string handling could be optimised a bit to avoid some clones by using Cow but that muddies the interfaces and might require adding a lifetime to the Network, so I think it's fine for now.

bindings/wasm/cypress/integration/browser_test.js Outdated Show resolved Hide resolved
bindings/wasm/examples/node/test.js Outdated Show resolved Hide resolved
bindings/wasm/examples/node/private_tangle.js Outdated Show resolved Hide resolved
bindings/wasm/examples/browser/private_tangle.js Outdated Show resolved Hide resolved
examples/account/private_tangle.rs Outdated Show resolved Hide resolved
examples/low-level-api/private_tangle.rs Outdated Show resolved Hide resolved
@PhilippGackstatter PhilippGackstatter force-pushed the feat/private-tangle-network branch from 9024ac8 to 73d4c63 Compare August 23, 2021 13:51
@PhilippGackstatter PhilippGackstatter merged commit e8f9e77 into dev Aug 24, 2021
@PhilippGackstatter PhilippGackstatter deleted the feat/private-tangle-network branch August 24, 2021 09:20
olivereanderson pushed a commit that referenced this pull request Oct 25, 2021
* Make `Network` not `Copy`

This is in preparation for adding another
non-`Copy` variant later.

* Add `Other` variant in `Network`

* Add node.js DID creation on private tangle example

* Add `from_name` in Wasm and fix absence of `Copy`

* Remove superfluous imports

* Add browser Wasm example

* Remove old variable

* Add low-level Rust API example

* Format Wasm network source code

* Add account Rust API example

* Use same ideas for account & low-level examples

* Rename `Network::as_str` to `name`

* Impl spec compliance check for `Network` names

* Change `IotaDID::network` return type to `Result`

* Change bindings according to new return type

* Improve Wasm examples with resolution step

* Add private tangle test

* Add cypress browser test

* Use `?` instead of `unwrap` where possible

* Add explorer url to `Network::Other` variant

* Add explorer_url tests

* Merge branch 'dev' into feat/private-tangle-network

* Fix `explorer_url` conversion

* Fix `message_url` in new examples

* Fix network names in Rust private tangle examples

* Update bindings/wasm/examples/node/test.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/cypress/integration/browser_test.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/examples/node/private_tangle.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/examples/browser/private_tangle.js

Co-authored-by: Craig Bester <[email protected]>

* Update examples/account/private_tangle.rs

Co-authored-by: Craig Bester <[email protected]>

* Update examples/low-level-api/private_tangle.rs

Co-authored-by: Craig Bester <[email protected]>

Co-authored-by: Craig Bester <[email protected]>
JelleMillenaar pushed a commit that referenced this pull request Nov 1, 2021
* Docs/readme improvs (#257)

* Update main readme

* WASM readme update

* Updated example with account

* Rust examples readme

* Bump wasm version

* Revert "Bump wasm version"

This reverts commit 73d9d66.

* consistent node version

* Bump wasm version

* Expand unit test coverage in bitset.rs, iota_did.rs, and iota_document.rs (#265)

* Add some tests

* Add IotaDocument::try_from_core() unit tests

* Fix clippy error

* read indexation payload from transaction payloads

* Remove IotaDID->DID Deref anti-pattern. (#269)

* Remove IotaDID->DID Deref anti-pattern.

* Address l1h3r review comments.

* Rework WASM examples to explicitly use client configs. (#275)

* Rework WASM examples to explicitly use client configs.

* Add explorer_util.js adn fix typo.

* Fix explorer URL construction.

Inlined the prefix since it is no longer exported.

* Bump dns-packet from 1.3.1 to 1.3.4 in /bindings/wasm (#277)

Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](mafintosh/dns-packet@v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump browserslist from 4.16.3 to 4.16.6 in /bindings/wasm (#278)

Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.3 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](browserslist/browserslist@4.16.3...4.16.6)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add IotaDocument::from_keypair_with_network() and WASM binding. (#276)

* Add IotaDocument::from_keypair_with_network() and WASM binding.

* Undo unintentional formatting in README.

* Add optional network arg to from_keypair WASM binding.

* Update API reference for fromKeyPair.

* Update README.

* Update bindings/wasm/src/wasm_document.rs

* Use u32 for message delays (#281)

* Use u32 for message delays

* Update docs

* Update version

* Bump ws from 6.2.1 to 6.2.2 in /bindings/wasm (#282)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Fix some typos in the method spec

* docs: Describe build process for wasm bindings

* Update iota-client (#270)

* Update iota-client

* Fix features

* New client builder

* New wasm client

* Update examples

* More common types (#283)

* Fragment/UnixTimestamp -> core::common

* clippy

* Timestamp::now -> Timestamp::now_utc

* Remove shard from DIDs (#280)

* Remove shard from DIDs

* wasm fixes

* update yarn.lock

* doctest

* Version Bump

* Restore checkCredential/checkPresentation WASM functions (#287)

* Restore client.checkCredential/checkPresentation

* doc: Serialize `message_id` for `IotaDocument`s

* wasm: Fix incorrect path in example imports

* client: Rename `read_document` to `resolve`

* Revert "doc: Serialize `message_id` for `IotaDocument`s"

This reverts commit 26e2dcd.

* wasm: Serialize `message_id` for resolve method

Co-authored-by: PhilippGackstatter <[email protected]>

* Add blake2b to wasm bindings (#288)

* Add blake2b to wasm bindings

* docs

* core: Reimpl `Key` with generics

* replace deleted method readDocument(id) with resolve(id) (#294)

* account: Disable custom riker logging

* Docs/setup docusaurus (#298)

* setup docusarus template

* add iota style and identity content

* add gh deploy action

* fix sidebar and titles

* change build dir

* fix folder name

* add specs, fix links

* fix images

* fix base path and github link

* add cname for security

* Add `publicKeyMultibase` (#307)

* Add publicKeyMultibase support

Add and expand base-encoding tests.

* Remove publicKeyHex

* Add verification method publicKeyMultibase test

* Ignore wasm lint warning

* setup documentation file structure in docusaurus

* Example Cleanup (#292)

* Default Network should be Mainnet

* Use remote PoW by default

* Always set a primary node

* Client updates

- Add TangleResolve for generic client implementations
- Add Receipt return value with additional txn info
- Rename `Client::transaction_url` -> `Client::message_url`

* Appease clippy

* Update examples

* Add ability to configure account clients (#293)

* Add ability to configure account clients

* rename

* stricter bound

* Use dashmap

* Explicit account test mode

* Fix missed method

* Ignore lint

* faster tests

* Minutes/2021 14 07 (#316)

* 2021-07-14

* 2021-07-14

* final

* Rename

Co-authored-by: HackMD <[email protected]>

* add codeSnippet component

* Update actions to pin Rust nightly version (#318)

Fix attempt for inconsistent Github Actions failures.

* Wasm examples browser (#317)

* create did through browser

* add examples to create and resolve DID

* add manipulate_did and create_vc

* and merkle key and revocation

* add missing index.html

* move node examples to separate folder

* update readme file

* remove web.js and format browser examples

* include node examples in git

* update readme links of node examples

* account: Add stronghold and re-export wasm feature (#291)

Signed-off-by: PhilippGackstatter <[email protected]>

account: Complete stronghold feature integration

account: Enable new resolver to fix wasm target

account: Use tokio 1.5 & split async feature

account: Add note on `Stronghold` availability

builder: Apply cargo fmt
Signed-off-by: PhilippGackstatter <[email protected]>

* Fix cyclic dependency (#319)

Remove unused preserve_order serde_json feature flag.

* update file paths

* add remark-import-partial plugin

* add missing doc files

* update landing page

* Fix inconsistent stronghold storage tests (#320)

Raise test timeouts and improve handling on slow systems.

* update footer/add empty team page

* remember selected programming language

* fix rust Replit

* change height of code snippet

* add teams page

* adjust team page

* minor edits to landing page

* Added DID Intro text

* Moved meeting minutes

* Remove mdbook docs

* Renamed DocOps -> documentation

* Updated deploy workflow documentation

* Updated blogs

* signature: Impl thread-safe `Cell` (#329)

Signed-off-by: PhilippGackstatter <[email protected]>

* update docusaurus.config.js

* Docs/docusaurus (#324)

* Docs/setup docusaurus (#298)

* setup docusarus template

* add iota style and identity content

* add gh deploy action

* fix sidebar and titles

* change build dir

* fix folder name

* add specs, fix links

* fix images

* fix base path and github link

* add cname for security

* setup documentation file structure in docusaurus

* add codeSnippet component

* update file paths

* add remark-import-partial plugin

* add missing doc files

* update landing page

* update footer/add empty team page

* remember selected programming language

* fix rust Replit

* change height of code snippet

* add teams page

* adjust team page

* minor edits to landing page

* Added DID Intro text

* Moved meeting minutes

* Remove mdbook docs

* Renamed DocOps -> documentation

* Updated deploy workflow documentation

* Updated blogs

* update docusaurus.config.js

Co-authored-by: huhn511 <[email protected]>
Co-authored-by: JelleMillenaar <[email protected]>

* Fix workflow

* Trigger workflow if itself changes

* Moved latest meeting notes

* Docs/docusaurus (#331)

* Docs/setup docusaurus (#298)

* setup docusarus template

* add iota style and identity content

* add gh deploy action

* fix sidebar and titles

* change build dir

* fix folder name

* add specs, fix links

* fix images

* fix base path and github link

* add cname for security

* setup documentation file structure in docusaurus

* add codeSnippet component

* update file paths

* add remark-import-partial plugin

* add missing doc files

* update landing page

* update footer/add empty team page

* remember selected programming language

* fix rust Replit

* change height of code snippet

* add teams page

* adjust team page

* minor edits to landing page

* Added DID Intro text

* Moved meeting minutes

* Remove mdbook docs

* Renamed DocOps -> documentation

* Updated deploy workflow documentation

* Updated blogs

* update docusaurus.config.js

* Fix workflow

* Trigger workflow if itself changes

* Moved latest meeting notes

Co-authored-by: huhn511 <[email protected]>
Co-authored-by: Abdulrahim Al Methiab <[email protected]>

* replace package-lock

* prevent broken links from failing the build

* fix docusaurus base URL

* Bump prismjs from 1.23.0 to 1.24.1 in /documentation (#330)

Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.1.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](PrismJS/prism@v1.23.0...v1.24.1)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add sccache to pipeline (#335)

* Add sccache to pipeline

* Fix Github Actions build-and-test include path

CI checks should correctly run if the build-and-test.yml definition changes
now.

* Fix sccache installation on Linux, Windows

* Debug Windows sccache path

* Add cache steps to all build CI jobs

Fix cache restore keys.

* Fix sccache restore keys

* * Upgraded docusaurus to improve mobile nav
* Fixed docs edit url

* * Fixed broken link

* Fix import.meta error (#340)

* Fix import.meta error

Update our workaround for webpack not supporting import.meta properly,
which causes an error when trying to use the Wasm web bindings with some
frameworks, e.g. React.

* Improve workaround regex

* Fix wasm examples (#337)

* Use camel case for JSON

* Fix messageId extraction

* Use explicit receipt var in examples

* Fix web explorer url

* Update yarn.lock

* Bump tar from 5.0.5 to 5.0.7 in /bindings/wasm (#346)

Bumps [tar](https://github.com/npm/node-tar) from 5.0.5 to 5.0.7.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v5.0.5...v5.0.7)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix libjose clippy lint (#348)

Remove needless borrow in libjose

* Add Wasm examples to CI (#345)

* Fix Wasm README.md example

Add Wasm examples CI job.
Update build-and-test CI to run wasm_bindgen annotated tests.

* Add txm annotations to test Wasm README.md example

Add txm to examples CI job.

* Fix Wasm node and README.md examples tests

The examples will now throw error codes on unsuccessful termination.

* Enable wasm examples CI job on PR temporarily

* Add configurable branch/ref for example CI

* Disable examples CI job on pull requests

* Rename Wasm Examples CI job

* Switch to jest for testing node bindings examples

* Add wasm browser example tests with cypress

Fix broken browser examples, doc strings.
Update example CI job with browser tests.
Temporarily enable examples CI job on PR for testing.

* Disable examples CI on PR

Update yarn.lock to include cypress

* improve node tests reliability

* improve browser test reliability

Co-authored-by: Abdulrahim Al Methiab <[email protected]>

* Bump version to 0.3.5 for @iota/identity-wasm@dev (#351)

Update package-lock.json

* Improve Wasm error handling (#344)

* Add WasmError

Enables idiomatic Javascript error handling with js_sys::Error which
includes error enum variant names.

* Add WasmError test

* remove book.toml (#341)

* Fix low-level links (#353)

Some of them were pointing to the wrong file.

* Update documentation links (#354)

* Update doc links

* Updated remaining incorrect links

Co-authored-by: JelleMillenaar <[email protected]>

* Add integration chain history/diff chain API (#347)

* Retrieve basic message history

* add Client::resolve_diffs

* Add WASM support/example

* Remove needless borrow

* cargo clean

* cargo fmt

* add did-history node example

* fix did-history node example

* add did-history browser example

* start implementing create_diff example for browser

* add create_diff examples

* fix revocation

* Address comments

Add clarifying comments to resolve history example.
Add wasm bindings equivalents for the resolve history example.
Add diff_chain example to base examples.
Add authorisation method to WasmDocument in order to use resolveDiffs.
Improve rustdoc comments.
Fix base example README.md references.

* Fix merge.

Fix clippy lint warnings.
Fix formatting.

* Remove leftover file from merge conflict.

* Fix format

* Fix wasm examples README.md

* Add Wasm binding history types

Add bridging Wasm structs for MessageHistory, DiffSet, DocumentDiff,
DiffChain, IntegrationChain.
Update client methods to return the briding structs where possible
instead of a serialized JsValue.
Improve error ergonomics in Wasm bindings by replacing
`.map_err(wasm_error)` with `.wasm_result()` and define a custom Result
type for JsValue errors.
Rename integration, diff chain `is_valid`/`check_validity` methods to
`is_valid_addition`/`check_valid_addition` to reduce ambiguity.
Add an extra check for the `message_id` in `check_valid_addition`.

* Export more functions to wasm bindings

Add publish_json, diff_address, integration_address to wasm bindings.
Update resolve_history example to include diff chain spam.
Remove message_id check from check_valid_addition added in previous
commit which was causing a test to fail.

* Export more structs to Wasm and update examples.

Export Timestamp and associated timestamp fields from IotaDocument to
Wasm bindings.
Update examples for parity between Rust, Nodejs, and browser versions.
Add revoke_vc Rust example.
Fix examples where from_keypair is used incorrectly to add new
verification methods.
Fix examples not setting the updated timestamp.
Fix printing nested JSON in examples/node/resolve_history.

* Fix README.md spelling.

* Fix broken Wasm examples

Fix merkle_key revocation example.
Fix invalid README.md references.

* Fix clippy, fmt warnings

* Refactor MessageHistory to DocumentHistory

Remove duplicate logic.
Remove Wasm bindings for DiffChain, IntegrationChain as per discussions
that those structures should be reserved for internal use and to keep
the external Wasm API cleaner.
Change `resolve_diff` to require a document previously published on the
integration change to avoid issues with validation.

* Export DocumentHistory to Wasm bindings

Fix spam messages returning the wrong message ids.
Change DocumentHistory structure due to Wasm binding limitations on
generics.
Update Wasm resolve_history examples.

* Update bindings/wasm/src/did/wasm_document.rs

Co-authored-by: Philipp <[email protected]>

* Update bindings/wasm/examples/browser/mainpulate_did.js

Co-authored-by: Philipp <[email protected]>

* Update identity-iota/src/chain/document_chain.rs

Co-authored-by: Philipp <[email protected]>

* Update document_chain.rs

Add doc comment for DocumentChain.

* Update document_chain.rs

Fix formatting.

* Fix whitespace formatting to satisfy CI

* Rename address to index

Corrects integrationAddress -> integrationIndex, diffAddress ->
diffIndex.

Co-authored-by: Abdulrahim Al Methiab <[email protected]>
Co-authored-by: Craig Bester <[email protected]>
Co-authored-by: Philipp <[email protected]>

* Bump version to 0.3.6 for @iota/identity-wasm@dev (#363)

* added cargo example build and dummy run

* added parallel execution for js and rust examples

* added actual cargo example run

* fixed cargo example run

* added output cache, changed cache key, reordering

* use jq instead of python

* use matrix build, caching for web examples

* use current branch

* Improve `Network` type to better support private tangles (#360)

* Make `Network` not `Copy`

This is in preparation for adding another
non-`Copy` variant later.

* Add `Other` variant in `Network`

* Add node.js DID creation on private tangle example

* Add `from_name` in Wasm and fix absence of `Copy`

* Remove superfluous imports

* Add browser Wasm example

* Remove old variable

* Add low-level Rust API example

* Format Wasm network source code

* Add account Rust API example

* Use same ideas for account & low-level examples

* Rename `Network::as_str` to `name`

* Impl spec compliance check for `Network` names

* Change `IotaDID::network` return type to `Result`

* Change bindings according to new return type

* Improve Wasm examples with resolution step

* Add private tangle test

* Add cypress browser test

* Use `?` instead of `unwrap` where possible

* Add explorer url to `Network::Other` variant

* Add explorer_url tests

* Merge branch 'dev' into feat/private-tangle-network

* Fix `explorer_url` conversion

* Fix `message_url` in new examples

* Fix network names in Rust private tangle examples

* Update bindings/wasm/examples/node/test.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/cypress/integration/browser_test.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/examples/node/private_tangle.js

Co-authored-by: Craig Bester <[email protected]>

* Update bindings/wasm/examples/browser/private_tangle.js

Co-authored-by: Craig Bester <[email protected]>

* Update examples/account/private_tangle.rs

Co-authored-by: Craig Bester <[email protected]>

* Update examples/low-level-api/private_tangle.rs

Co-authored-by: Craig Bester <[email protected]>

Co-authored-by: Craig Bester <[email protected]>

* remove target cache

* added exit condition

* improved naming

* changed sccache key

* use release mode to build examples

* renamed workflow

* Add HTML remove comments remark plugin (#366)

* Remove `toUnix` and `fromUnix` methods in `WasmTimestamp` (#365)

* Remove unix methods in Timestamp due to #362

* Add lint to avoid future reintroduction of i64/u64

* Update Wasm docs

* Link the relevant issue in the lint

* Bump version to 0.3.7 for @iota/identity-wasm@dev (#368)

* Bump url-parse from 1.5.1 to 1.5.3 in /documentation (#356)

Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.5.1...1.5.3)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump url-parse from 1.5.1 to 1.5.3 in /bindings/wasm (#357)

Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.5.1...1.5.3)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix iota-client dependency (#371)

* Update dependency versions

Fix iota-client dependency resolution error in GitHub Actions.
Update minor dependencies.

* Fix Rust examples CI failures

Prevent private_tangle examples returning an error on publish when no
private Tangle is running locally.

* Update wasm bindings resolver to version 2

Removes mio dependency which cannot be compiled to the wasm target. It
was brought in by tokio features in dev-dependencies, hence why the new
resolver works.

* Update iota-client dependency pinned commit

Fix Wasm compilation.

* Migrate riker stronghold to actix version (#370)

Move password expiration to the stronghold thread

Asyncify the tests

Fix "unnecessary let binding"-lint

Update to latest stronghold & crypto.rs

Fix clippy "let binding returned" lint

Improve unwrap safety documentation

Improve error handling in stronghold init

Simplify stronghold init statement

Upgrade all crates to iota-crypto 0.7

Improve error handling and use `expect` everywhere

Alphabetize `Cargo.toml`

Fix "block in if condition" clippy lint

* Bump to 0.3.8 for @iota/identity-wasm@dev, add set_message_id (#373)

* Add set_message_id to WasmDocument

Allow setting the message_id on DID documents in the wasm bindings.

* Bump version to 0.3.8 for @iota/identity-wasm@dev

* Fix messageId in create_did Wasm examples

* Make sccache installation a bit faster on macOS (#374)

* Bump to 0.3.9 for @iota/identity-wasm@dev, fix messageId  (#376)

* Fix WasmDocumentDiff message_id

Fix message_id incorrectly returning the previous_message_id.

* Bump version to 0.3.9 for @iota/identity-wasm@dev

* Enable the creation of an identity from a `KeyPair` in the `Account` (#352)

* Add `key_insert` function in `Storage` trait

* account: Impl keygen from bytes for `MemStore`

* account: Remove unused imports

* account: Document key size for Ed25519

* account: Fix clippy dereference lint

* account: Remove unnecessary comment

* account: Document `secret_key` better

* account: Fix ed25519 key size doc comment

* Add optional `secret_key` to `CreateMethod`

* Use renamed crypto methods in `MemStore`

* Add creating id from secret key tests

* Update stronghold to bug-fixed version

* Add stronghold insertion test

* Return proper error on invalid key length

* Implement method_secret for `CreateMethod`

* Add key size check in `CreateIdentity`

* Don't test error message itself

* Use `MethodSecret` in `IdentityCreate`

* Test type/secret mismatch

* Move insertion logic to new method

* Refactor `NetworkName` (#375)

* Add NetworkName

Use a newtype wrapper for network names to enforce spec compliance.
Fix potential bug with ClientMap theoretically having duplicate network
clients when custom explorer URLs are set.

* Update IotaDID to validate network name

Rename `with_network` to `new_with_network`.

* Fix Wasm bindings

Add `Network::name_str` to avoid cloning the `NetworkName`.

* Remove did! macro

The did! macro was unused and just converted the errors from try_did!
into panics.
Add network validation tests for Account::create_identity.

* Address comments

Rename Network::from_name to Network::try_from_name
Rename NetworkName::try_from_name to NetworkName::try_from
Rename try_did! to try_construct_did!

* Fix compilation

* Bump tar from 5.0.7 to 5.0.11 in /bindings/wasm (#378)

Bumps [tar](https://github.com/npm/node-tar) from 5.0.7 to 5.0.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v5.0.7...v5.0.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Extend Network doc comment for other networks (#382)

* extend doc comment

* Fix spelling

* Add build step for Wasm examples (#369)

* added build step for examples

* enable more examples

* enabled more examples, cleaned up utils

* removed platform specific examples

* fixed node tests

* copy index.html to dist

* enable all examples

* changed example server root

* fixed browser test

* fixed wasm path

* enabled all node tests

* added example build to workflow

* renamed build step

* fixed tests

* added example build to README

* fixed example path

* added sourcemap option to build step

* removed redundant try catch

* added WASM example build to build and test

* fixed Readme links

* changed test command

* added signature for linkify method

* minor rework of resolution workflow

* Use a network name that matches part of the private tangle network id (#383)

* Fix private tangle examples

* Fix Wasm private tangle examples

* * Removed comment about txm which causes a compilation error upon importing from the wiki (#384)

* Change build workflow step to avoid recompilation (#386)

* Fix Wasm private-tangle example (#389)

Fixes failing example tests when nothing (undefined) is passed to the function.

* Revert "* Removed comment about txm which causes a compilation error upon importing from the wiki (#384)" (#385)

This reverts commit 0f5be7e.

* Docs - Improve SEO (#380)

* * Browser friendly descriptive urls
* Removed duplicate onBrokenLinks declaration in config

* * Removed Docusarus assets.
* Added description, image and keywords for all docs.
* Added alt attribute to images
* Upgraded to docusarus beta 4
* Added png identity icon

* Apply suggestions from code review

Co-authored-by: charlesthompson3 <[email protected]>

Co-authored-by: charlesthompson3 <[email protected]>

* Content for create did, replit improvements (#372)

* Content for create did, replit improvements

* md

* Improved phrasing based on suggestions

* use Cargo.lock for caches, remove libjose caches (#390)

* use Cargo.lock for caches, remove libjose caches

* fix sccache env

* Update .github/workflows/build-and-test.yml

Co-authored-by: Craig Bester <[email protected]>

* Update .github/workflows/build-and-test.yml

Co-authored-by: Craig Bester <[email protected]>

Co-authored-by: Craig Bester <[email protected]>

* Enable lazy tangle updates in the `Account` (#377)

* Implement pushing unpublished commits to tangle

* Improve methods added to the storage interface

* Bail early if no commits to publish

* Implement new storage methods for `Stronghold`

* Implement clippy suggestions

* Add lazy publish example

* Add lazy publish test

* Apply format

* Replace `unwrap` with `?`

* Implement a "network-resilient" test runner

* Make identity updates thread-safe

* Expand docs, fix nitpicks

* Add lock to `publish_changes`

* Return locks lazily in `get_lock`

* Remove lock when deleting from index

* Clone locks when cloning the index

* Rename document to did in all examples

* Fix spelling, docs, naming

* Improve docs, simplify code

* Add `IdentityLock` type

* Rename `publish_changes` -> `publish_updates`

* Internalize `Account` commands (#391)

* Impl basic `account.new_command` idea

* Fix apply impl

* Enable multiple updates on an updater

* Flesh out `IdentityUpdater` impl

* Fix command tests

* Rename document to did in all examples

* Update examples to use new update syntax

* Add documentation

* Remove Default impl, use proper macro path for key

* Document `IdentityUpdater`, derive basic traits

* Update recently added tests

* Roll back name change

* Reference `key` to get rid of `Clone` requirement

* Remove `CreateIdentityBuilder`

* Call `update_identity` on each update

* Move tests inside the account crate

* Document `IdentityUpdater` methods

* Rename `CommandError` -> `UpdateError`

Avoids having `Command` in the public interface.

* Update stray occurrence of `CommandError`

* Use better name for captured attribute in macro

* Move lazy test inside the crate & update syntax

* Remove `Clone` bound

* Rename `CommandError` -> `UpdateError` in account

* Make `resolve_id` method signatures consistent

* Move builder doc to the fn instead of the impl

* Replace yarn with npm (#394)

* Replace yarn with npm

* Fix npm publish included files

Exclude examples from published wasm bindings package.

* Update wasm bindings README.md

Add link to examples.
Add note on import statements.
Improve formatting.

* Add toml formatting (#393)

* Add dprint for Cargo.toml formatting

Add dprint check to format CI action.

* Format toml files

* Fix format workflow

* Use pre-packaged dprint from npm

* Disable incremental compilation in CI

Attempt to reduce cache size.

* Fix rustdoc lint warnings

Re-enable incremental cargo compilation in CI except for build-and-test-wasm.

* Remove redundant format check

* Add composite action to CI (#392)

* Add IOTA wiki CLI (#381)

* Add document merge to wasm bindings (#401)

* Update document merge functions in wasm bindings

Add WasmDocumentDiff::merge()
Update parameter of WasmDocument::merge()

* Fix formatting

* Fix IntegrationChainHistory, DiffChainHistory bindings

* Remove redundant js_class, js_name attributes

* Bump version to 0.3.10 for @iota/identity-wasm@dev (#402)

* Rename document1 to did1 in README example. (#400)

* Rename document1 to did1 in README example.

Previously, the example used `document1` to refer to the DID, whereas the "document" isn't resolved until `account.resolve_identity()` is called.

* Apply suggestions

* Fix wasm compilation (#404)

Explicitly enable tokio "rt" feature to fix compilation of bee-runtime
dependency.

* Replace `testnet` with `devnet` (#405)

* Replace testnet with devnet

* Update documentation

* Small wiki content tweaks. (#399)

- Fix "_Rust_ API Reference" title
- Some acronym expansions
- Consistently hyphenate Self-Sovereign Identity
- Link to Rust and WASM API reference (they're still stubs though)
- Some small wording tweaks

* Bump version to 0.3.11 for @iota/identity-wasm@dev (#416)

Add `proof` field getter for WasmDocumentDiff.

* Initial content for VC Wiki Overview page (#407)

* Initial content for VC Wiki Overview page

* Address Jelle's review comments (round 1).

* Update README.md (#413)

changed links for documentation to wiki.iota.org links

* Bump tmpl from 1.0.4 to 1.0.5 in /bindings/wasm (#410)

Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Rename SecretKey to PrivateKey throughout identity.rs code base. (#409)

* Rename SecretKey to PrivateKey throughout identity.rs codebase.

* Fix formatting issues.

* Resolve cycraig review (more secret->private renamings)

* Add stub content to IOTA DID Resolution wiki page. (#406)

* Add stub content to IOTA DID Resolution wiki page.

* Address Jelle's review comments (explorer, wording, etc.)

* Add default signing key as a generic verification method (#421)

* Rename auth to int chain everywhere

* Create verification method with attached auth

* Fix generations in tests

* Update remaining generations in tests

* Remove outdated TODO

* Impl generic verif method in low level API

* Use 'integration' instead of 'int'

* Add test that verifies number of verif. methods

* Assert the authentication relationship

* Fix Document constructor Typescript bindings (#423)

* Fix WasmDocument constructor Typescript bindings

Replace IotaDocument `from_keypair()`, `from_keypair_with_network()` with `new()`.
Update Wasm binding examples to be more consistent with Rust.

* Fix test and benchmark compilation

* Fix benchmark compilation

* Apply suggestions from code review

* Add Document::new_with_options constructor

Allow default verification method fragment to be specified.
Add doc, unit tests.

* Use NetworkName instead of &str

Remove IotaDID::from_components.
Remove specific InvalidNetworkName strings for consistency with other errors and to use with TryInto.
Allow Network::try_from_name to take an actual NetworkName as well as a
string.

Co-authored-by: Philipp <[email protected]>

* Fix example dependencies in Readme (#430)

Account feature has to be added to the identity dependencies to use identity::account::*.

* Update Account API to return IdentityState from find_identity and create_identity (#414)

* Update Account::create_identity() to return IdentityState.

* Update Account::find_identity() to return IdentityState.

* Fix Wasm network calls, pin reqwest to 0.11.4 (#439)

* Rename JSON serialization field name to match spec. (#412)

* Rename JSON serialization field name to match spec.

* Rename notSupported -> representationNotSupported

* Reduce WASM build size (#427)

* reduce wasm build size

* Enable lto for Wasm release

Add `build-dev` task for Wasm for debugging.

Co-authored-by: Craig Bester <[email protected]>

* Chore/combine examples (#420)

* Merged Stronghold with basic examples in account

* Updated explorer to identity resolver

* Added explorer URL after basic example

* Renamed examples

* Completed manipulate did example

* Fixed suggestions, removed replaced examples.

* Improved example readme

* Consistently use Stronghold and Resolver URL

* Fix examples

* Merged config example with private tangle

* low-level-api private-network example runs

* cargo fmt

* cargo fmt with nightly

* Impl suggestions

* Docs - Reogranize Docs, Add Examples & Cheat Sheet (#425)

* Reorganized files

* Renamed .md files to .mdx (see https://docusaurus.io/docs/next/markdown-features/react)
Added examples
Deleted unused files
Updated sidebar
Added 20px margin bottom for replit embedded object
Removed redundant units and props in styles.css

* added NLOF

* Apply suggestions from code review

Co-authored-by: charlesthompson3 <[email protected]>

* Added Wasm Cheat and Rust Cheat sheet skeleton

* Apply suggestions from code review

Co-authored-by: charlesthompson3 <[email protected]>

* fix typo

* Fixed links
ADded first draft of rust cheat sheet
Changed extension in verifiable_presentations.md to mdx

* Added example output for all functions in the WASM cheat_sheet.md

* Added example JSON output for all functions in the Rust cheat_sheet.md

* Added tutorial

* Formatted tutorial

* Addressing comments:
* Added instructions and descriptions on installing both main and dev branches.
* Removed low level API items from rust cheat sheet and added Account modules examples where possible.
* Added stronghold, private tangle and vp account module examples

* * added branch specific installation instructions
* fixed html in cheat_sheet.md

Co-authored-by: charlesthompson3 <[email protected]>

* Update CI cache action versions (#435)

* updated cache action versions

* added actions to watched paths

* updated cache version for examples workflow

* Docs - Fix build (#445)

* * Replaced imported account module stronghold example with basic example.
* Removed reference to deleted account module examples
* Added test action to catch future include issues

* testing action

* removed action as I wasn't being successful at all

* Added combined examples as suggested by @cycraig

* Added missing include statements (#446)

* Update TimeCop to avoid Into<SystemTime> (#444)

Out of an abundance of caution. Not an actual vulnerability since
`set_current` is unused and we don't use any SystemTime conversions
affected by a known vulnerability.

* Update methods to default to `PublicKeyMultibase` (#443)

* Update methods to default to PublicKeyMultibase

* Update documentation to use PublicKeyMultibase

* Separate `DID`, `DIDUrl` constructs (#428)

* Add separate DID, DIDUrl constructs

Add DID trait.
Add CoreDID, IotaDID structs.
Add DIDUrl generic struct.
Update various structs and functions to use a DID instead of a DIDUrl
where appropriate.

* Implement RelativeDIDUrl

Add extra CoreDID validation.
Add RelativeDIDUrl doctests.
Update tests, examples.

* Add DID Url unit tests.

Handle relative DID Url edge-cases.
Remove uriparse dependency.

* Fix formatting

* Fix clippy lint warnings

* Fix dereference_document

Add dereference unit tests.

* Fix formatting, clippy lint warnings

Add missing licence headers.

* Fix tests, benchmarks

* Remove unsafe cast in IotaVerificationMethod

* Add WasmDIDUrl

Update Wasm examples.

* Fix wasm formatting

* Improve RelativeDIDUrl comparisons

* Improve DIDUrl parsing

Re-export BaseDIDUrl to satisfy TryFrom<BaseDIDUrl> without adding the
`did_url` crate dependency to other projects.

* Remove resolution metadata check

Fix formatting.

* Change remove_service, remove_method parameters

Add doc comments.

* improved documentation

* fixed formatting

* Set `explorer_url` in private Tangle example (#454)

* Use explorer_url from custom network

* Use devnet explorer url

Co-authored-by: Craig Bester <[email protected]>

* Fix explorer url formatting

Co-authored-by: Craig Bester <[email protected]>

* Fix low-level private tangle example (#461)

* Fix low-level private tangle example

* Keep discussion on network name requirements

* Fix links in documentation (#450)

* Fix links in create.mdx

* Fix links in validate_university_degree.mdx

* Add dark image (#469)

* Clean up Documentation (#463)

* Removed meeting minutes

* Removed copy

* Fixing some links

* Removed Blog

* Add IOTA DIDComm protocols specification (#379)

* [WIP] Add DIDComm protocol specifications

* [WIP] Describe presentation messages

* [WIP] enhanced presentation protocol

* [WIP] enhanced presentation protocol

* [WIP] enhanced presentation protocol

* [WIP] enhanced presentation protocol

* [WIP] Add alternative presentation diagrams

* [WIP] further work on presentation

* [WIP] added signing protocol

* [WIP] further signing protocol

* [WIP] further signing protocol

* [WIP] fixed presentation

* [WIP] added issuance

* [WIP] further issuance

* [WIP] added credential-types, renamed problem-reports

* [WIP] minor cleanup

* [WIP] furthr work on issuance

* [WIP] further work on issuance

* [WIP] further work on issuance

* [WIP] further work on issuance

* [WIP] further work on issuance

* [WIP] further work on issuance

* [WIP] added revocation

* [WIP] added revocation diagram

* [WIP] added revocation-options, further revocation

* [WIP] further revocation-options, further revocation

* [WIP]further revocation

* [WIP]further revocation and revocation-options

* [WIP]further revocation and revocation-options

* [WIP] added termination

* [WIP] reference external flows

* [WIP] add presentation-exchange to presentation

* [WIP] further revocation

* [WIP] further revocation

* [WIP] further revocation

* added connection

* [WIP] further connection

* [WIP] further connection

* [WIP] further connection

* [WIP] further connection, added authetication

* [WIP] further authetication

* [WIP] fixed typos

* [WIP] further auth]

* [WIP] further auth

* [WIP] further auth

* [WIP] further auth

* fixed typo

* [WIP] problem reports

* problem reports

* further problem reports

* further problem reports

* problem reports, added 'post' protocol

* added post

* type negotiation, reworked revocation

* type negotiation

* cleanup

* added introduction

* editing

* editing

* editing

* Update issuance.md

fixed grammar.

* added potential future CrendentialInfo methods

* Fix Credential Kinds links

Minor formatting.

* First 3 files review, typos and extra info

* Update DIDComm spec introduction slightly

* Change DIDComm spec sidebar ordering

* Edit trust paragraph in authentication

Remove redundant authentication example.

* Update connection->feature discovery relationship

* Minor changes to presentation

* Spelling fixes

* Reorder resources section to after protocols in overview

* Reorder revocation to before revocation options

* Improve credential links in presentation

* Fix footnote numbering in signing

* Update signing authorisation consideration

* added description to sections

* fix sidebar links

* added diagram section

* Deduplicate authentication protocol links

* Deduplicate connection protocol links

* Deduplicate issuance protocol links

* Deduplicate presentation protocol links

* Deduplicate signing protocol links

* changed intro text

* further presentation

* cleaned up presentation

* further overview

* further authentication

* renamed Credential Kinds, added description for trust considerations

* further authentication

* reworked presentation

* updated changelog

* removed TODO

* fixed links

* added disclaimer and changed headline structure

* updated 'last updated'

Co-authored-by: Eike Haß <[email protected]>
Co-authored-by: Oliver Anderson <[email protected]>
Co-authored-by: JelleMillenaar <[email protected]>

* Restrict KeyCollection sizes (#411)

* add an upper limit to the amount o keys that can be generated

* comment count new behavior

* fix pre-existing test to adjust to next power of two policy

* set upper limit to 2^32

* define an upper limit of 2^12 for key collection

* add check before allocating vec

* throw error when trying to create a KeyCollection with 0 keys, improve comments

* fix comment

* run cargo fmt

* add const MAX_PROOF_NODES for limiting the amount of nodes in a Proof

* fix fmt

* Clean up previous didcomm impl (#470)

* Removed messages from the wasm bindings

* Revert "Removed messages from the wasm bindings"

This reverts commit e66cf82.

* cleaned up identity-comm/src/messages and identity-comm/src/tests (#467)

* deleted bindings/wasm/src/message (#468)

* build api-reference

Co-authored-by: Oliver Anderson <[email protected]>
Co-authored-by: Eike Haß <[email protected]>

* bump wasm to v0.4.0 (#472)

* Bump crate versions to `0.4.0` (#471)

* Bump crate versions to `0.4.0`

* Bump `identity-wasm`, too!

* Bump `identity-wasm` itself, too.

Co-authored-by: l1h3r <[email protected]>
Co-authored-by: Devin Turner <[email protected]>
Co-authored-by: Matt Renaud <[email protected]>
Co-authored-by: Thoralf-M <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: PhilippGackstatter <[email protected]>
Co-authored-by: Abdulrahim Al Methiab <[email protected]>
Co-authored-by: huhn511 <[email protected]>
Co-authored-by: Craig Bester <[email protected]>
Co-authored-by: Abdulrahim Al Methiab <[email protected]>
Co-authored-by: HackMD <[email protected]>
Co-authored-by: Craig Bester <[email protected]>
Co-authored-by: lucastortora <[email protected]>
Co-authored-by: eGarciaR <[email protected]>
Co-authored-by: Thoralf-M <[email protected]>
Co-authored-by: Eike Haß <[email protected]>
Co-authored-by: Rajiv Shah <[email protected]>
Co-authored-by: lucas-tortora <[email protected]>
Co-authored-by: charlesthompson3 <[email protected]>
Co-authored-by: Phyloiota <[email protected]>
Co-authored-by: Christian M <[email protected]>
Co-authored-by: Oliver Anderson <[email protected]>
Co-authored-by: Dr-Electron <[email protected]>
Co-authored-by: Henrique Nogara <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Support for Private Tangle
4 participants